﻿function selectmonth(mth) {
    if (mth == 1) {
        $('#selectmonth').val(1);
        $('#mth1').css('background-image', 'url(/Content/M/images/0331_01.png)');
        $('#mth2').css('background-image', 'url(/Content/M/images/0331_02.png)');
        $('#mth3').css('background-image', 'url(/Content/M/images/0331_02.png)');
    } else if (mth == 2) {
        $('#selectmonth').val(1.5);
        $('#mth2').css('background-image', 'url(/Content/M/images/0331_01.png)');
        $('#mth1').css('background-image', 'url(/Content/M/images/0331_02.png)');
        $('#mth3').css('background-image', 'url(/Content/M/images/0331_02.png)');
    } else if (mth == 3) {
        $('#selectmonth').val(2);
        $('#mth3').css('background-image', 'url(/Content/M/images/0331_01.png)');
        $('#mth1').css('background-image', 'url(/Content/M/images/0331_02.png)');
        $('#mth2').css('background-image', 'url(/Content/M/images/0331_02.png)');
    }
}
function selectDate_1(close) {

    var fd = $("#BabyBornTime").text();
    if (!fd) {
        var temp = new Date();
        fd = temp.format('yyyy-MM-dd');
    } else {
        fd = fd.match(/\d{4}-\d{1,2}-\d{1,2}/)[0];
    }
    var nd = addNDays(fd, $('#selectmonth').val() * 26);
    var getNewDay = nd.format('yyyy-MM-dd');
    if ($('#data_box .trigger span').length == 2) {
        $(".showDate").html(fd);
        $(".showDateEnd").html(getNewDay);
    } else {
        $("#BabyBornTime").html(fd + "至" + getNewDay);
    }
    window.localStorage.setItem("BabyBornTime", fd + "至" + getNewDay);

    sel_date_hide();
    //if ($('#data_box .trigger span').length == 2) {
    if ($('.show-Date').length != 0) {
        if (url.indexOf('shsj') != -1) {
            url = url.replace(getURLParameter('shsj'), fd + "-" + getNewDay);
        } else {
            url = url + '?shsj=' + fd + '-' + getNewDay + ''
        }

        window.location = url;
    }
}
function getURLParameter(oName) {
    return decodeURI((RegExp(oName + '=' + '(.+?)(&|$|#)').exec(location.href) || [, null])[1]);
}
function choosedate() {
    document.getElementById("BabyBornTime").click();
}
